package com.goldcn.goods.dao;

import com.goldcn.goods.dto.*;
import com.goldcn.goods.model.GoodsInfo;
import com.goldcn.goods.model.GoodsInfoWithBLOBs;
import com.goldcn.goods.model.GoodsSku;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface GoodsInfoMapper {
    int insertSelective(GoodsInfoWithBLOBs record);

    GoodsInfoWithBLOBs selectByPrimaryKey(Long goodsID);

    GoodsInfoWithFristSkuDto selectByPrimaryKeyWithFristSku(Long goodsID);

    int updateByPrimaryKeySelective(GoodsInfoWithBLOBs record);

    int updateBySoldoutTime(Long goodsID);

    List<QueryResultGoodsDto> selectCondition(QueryGoodsDto queryGoodsDto);

    /**
     * @Author Tim Peng
     * @Description 店铺上下架商品搜索
     * @param queryGoodsDto
     * @return
     * @Date 2018/7/12 10:57
     */
    List<QueryResultGoodsDto> selectConditionV2(QueryGoodsDto queryGoodsDto);

    List<QueryResultGoodsDto> selectShopCondition(QueryGoodsDto queryGoodsDto);

    int updateGoodsState(GoodsStateInfoDto state);

    GoodsInfoWithSkuDto selectBySkuID(Long skuID);

    /**
     * v2带会员价
     *
     * @param skuID
     * @param vipLevel
     * @return
     */
    GoodsInfoWithSkuDto selectBySkuIDv2(@Param("skuID") Long skuID, @Param("vipLevel") Long vipLevel);

    GoodsInfoWithSkuDto selectBySkuIDvShop(@Param("skuID") Long skuID, @Param("vipLevel") Long vipLevel, @Param("shopID") Long shopID);

    GoodsCountInfoDto selectCountGoodsDataBySupplierID(@Param("supplierID") Long supplierID, @Param("companyID") Long companyID);

    int opeateInventoryOrSales(@Param("saleNumber") Integer saleNumber,
                               @Param("inventoryNumber") Integer inventoryNumber, @Param("goodsID") Long goodsID);

    List<Map<String, Object>> selectGoodsRankBySales(@Param("supplierID") Long supplierID, @Param("topNum") int topNum, @Param("companyID") Long companyID);

    List<Map<String, Object>> selectMultipleGoodsPrice(List<Long> goodsIDs);

    /**
     * v2带会员价
     *
     * @param goodsIDs
     * @param vipLevel
     * @return
     */
    List<Map<String, Object>> selectMultipleGoodsPriceV2(@Param("list") List<Long> goodsIDs, @Param("vipLevel") Long vipLevel);

    List<GoodsSku> test();

    Map<String, Object> selectUnapproveGoodsNum(@Param(value = "supplierID") String supplierID, @Param(value = "companyID") Long companyID);

    List<Map<String, Object>> selectGoodsTop(@Param("topNum") int topNum, @Param("companyID") Long companyID);

    Integer getOnSalesCounts(@Param(value = "companyID") Long companyID);

    /**
     * 根据款号加载
     *
     * @param proNo
     * @return
     */
    Long selectByPrdNo(@Param("proNo") String proNo, @Param("companyID") Long companyID);


    int deleteByList(List<Long> goodIDs);

    List<Long> selectGoodIds(Long companyId);

    int deleteByPrimaryKey(Long goodIDs);

    List<Long> selectAll(@Param("companyID") Long companyID, @Param("isAudit") Integer isAudit);

    List<GoodsInfo> selectAllByCompanyID(@Param("companyID") Long companyID);

    int updateVal(GoodsInfo goodsInfo);

    List<Map<String, Object>> selectForB2b();

    List<String> selectBigClassByGoodIds(List<String> list);

    List<String> selectSmallClassByGoodIds(List<String> list);

    List<Map<String, String>> selectByGoodsIDs(@Param("list") List<Long> goodsIDs, @Param("companyID") Long companyID);

    List<Map<String, String>> selectByGoodsIDsShop(@Param("list") List<Long> goodsIDs, @Param("companyID") Long companyID,@Param("shopID") Long shopID);


    int updateCartShopGoodsDown(Map<String, Object> param);

    int updateShopGoodsDown(Map<String, Object> param);

    int deleteShopByGoodsID(@Param("goodsID") Long goodsID, @Param("shopID") Long shopID);

    int deleteShopSkuByGoodsID(@Param("goodsID") Long goodsID, @Param("shopID") Long shopID);


    GoodsInfoWithBLOBs selectShopByPrimaryKey(@Param("goodsID") Long goodsID, @Param("shopID") Long shopID);


    /**
     * 店铺价格
     *
     * @param goodsIDs
     * @param shopID
     * @return
     */
    List<Map<String, Object>> selectMultipleGoodsPriceShop(@Param("list") List<Long> goodsIDs, @Param("shopID") Long shopID);


    List<GoodsInfoWithBLOBs> selectWithBLOBsByCon(QueryGoodsDto queryGoodsDto);


    /**
     * 店铺所用到的一级分类列表
     * @param shopID
     * @return
     */
    List<Map<String, Object>> selectClazzListByShopId(@Param("shopID") Long shopID);


}